import Vue from "vue";
import Router from "vue-router";
Vue.use(Router);
import MSite from '../pages/MSite/MSite.vue'
import Shop from '../pages/Shop/Shop.vue'
import ShopGoods from '../pages/Shop/ShopGoods/ShopGoods.vue'
import ShopRating from '../pages/Shop/ShopRating/ShopRating.vue'
import ShopInfo from '../pages/Shop/ShopInfo/ShopInfo.vue'


export default new Router({
  routes: [
    {
      path: "/msite",
      name: "msite",
      component: MSite,//()=>{import('../pages/MSite/MSite.vue')}
      meta:{
        showFooterGuide:true
      }
    },

    {
      path:'/search',
      name:"search",
      component:()=>
          import("../pages/Search/Search.vue"),
        meta:{
            showFooterGuide:true
        }

    },
    {
      path: "/order",
      name: "order",

      component: () =>
        import(/* webpackChunkName: "about" */ "../pages/Order/Order.vue"),
        meta:{
            showFooterGuide:true
        }
    },
    {
      path:'/profile',
      name:"profile",
      component:()=>
          import('../pages/Profile/Profile.vue'),
        meta:{
            showFooterGuide:true
        }

    },
    {
      path:'/login' ,
      name:"login",
      component:()=>import('../pages/Login/Login.vue')
    },
      {
        path:'/userinfo',
        name:"userinfo"  ,
        component:()=>import('../pages/UserInfo/UserInfo.vue')
      },
      {
        path:'/shop/:id',
        name:"shop",
        component:Shop  ,
        redirect:"/shop/:id/goods",
        children:[
            {path:'/shop/:id/goods',component:ShopGoods},
            {path:'/shop/:id/rating',component:ShopRating},
            {path:'/shop/:id/info',component:ShopInfo}
        ]
      },
    {
      path:'/',
      redirect:'/msite'
    }
  ],
     scrollBehavior (to, from, savedPosition) {   return { x: 0, y: 0 } }
});
